Private Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Declare Function MoveWindow Lib "user32" (ByVal hWnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Private Declare Function CreateDialogParam Lib "user32" Alias "CreateDialogParamA" (ByVal hInstance As Long, ByVal lpName As String, ByVal hWndParent As Long, ByVal lpDialogFunc As Long, ByVal lParamInit As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Public Declare Function DestroyWindow Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function DeleteObject& Lib "gdi32" (ByVal hObject As Long)
Private Declare Function DestroyIcon Lib "user32" (ByVal hIcon As Long) As Long
Private Declare Function GetObjectAPI& Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any)
Public Const TEMP_FILE_NAME = "c:\tempfile.tmp"
Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As Any, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Public hDialog As Long
Public Function ShowAVI(ByVal ResName As String, pb As PictureBox) As Boolean
Dim arr() As Byte
Dim mciCmd As String
Dim nFile As Integer
Dim sReturn As String * 128
Dim nWidth As Long, nHeight As Long
Dim lStart As Long, lPos As Long
If Dir(TEMP_FILE_NAME) <> "" Then
Call mciSendString("close video", 0&, 0, 0)
Kill TEMP_FILE_NAME
End If
arr = GetDataArray("AVI", ResName)
nFile = FreeFile
Open TEMP_FILE_NAME For Binary As #nFile
Put #nFile, , arr
Close #nFile
mciCmd = "open " & TEMP_FILE_NAME & " Type avivideo Alias video parent " & pb.hWnd & " Style child"
Call mciSendString(mciCmd, 0&, 0, 0)
Call mciSendString("Where video destination", ByVal sReturn, Len(sReturn) - 1, 0)